﻿using Tfs.OnTheRoad.Commands;
using Tfs.OnTheRoad.Model;
namespace Tfs.OnTheRoad.ViewModel
{
    /// <summary>
    /// Branch List ViewModel
    /// </summary>
    public class BranchListViewModel : BaseListViewModel<Branch>
    {
        public NavigateToBranchCommand NavigateToBranch
        {
            get;
            private set;
        }

        private Project _currentProject;

        public Project CurrentProject
        {
            get { return _currentProject; }
            set { _currentProject = value; }
        }

        public BranchListViewModel(Model.Project project)
            : base()
        {
            NavigateToBranch = new NavigateToBranchCommand();
            _currentProject = project;
            PageTitle = "Branches";
            OrderBy = "DateCreated desc";
        }

        public BranchListViewModel(string path)
            : base(path)
        {
        }

        public override string GetNoResultsFoundMessage()
        {
            return "No branches were found.";
        }

        public override string GetEntityCollectionName()
        {
            return string.Format("Projects('{0}')/Branches", _currentProject.Name); ;
        }
    }
}
